﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Portal.Cms.Model
{
    public class TabItem
    {
        public string Id;
        public string Title;
        public string Body;
        public TabItem()
        {
        }

        public TabItem(string _Id, string _Title,string _Body)
        {
            Id = _Id;
            Title = _Title;
            Body = _Body;
        }

        public TabItem(string _Id, string _Title)
        {
            Id = _Id;
            Title = _Title;
            Body = "";
        }
    }

    public class Tab
    {
        public static string GetTabItems(
            string SiteId,
            TabItem[] TabItems,
            string TabIndex,
            string Body,
            string Javascript)
        {
            string Html =
                 "<div class=tabs>\r\n" +
                 "<div class=\"section-" + TabIndex + "\">\r\n" +
                 " <ul class=\"menu\">\r\n";
            for (int iIndex = 0; iIndex < TabItems.Length; iIndex++)
            {
                string JavascriptPage = string.Format(Javascript, (iIndex+1));
            
                Html +=
                 "      <li id=\"nav-" + (iIndex + 1) + "\"><a href=\"" + JavascriptPage + "\">" + TabItems[iIndex].Title + "</a></li>\r\n";
            }
            Html+=
                 " </ul>\r\n" +
                 " <div id=\"contents\">\r\n"+
                     Body+
                 " </div>\r\n" +
                "</div>\r\n" +
                "</div>\r\n";
           
            return Html;
        }
    }
}
